﻿import objix
import time
import marshal
import types

def clandestine():

	m = objix.main()
	a = m.get_all_events(objix.n)
	b = time.time()

	for x in a.keys():
		for y in a[x]:
			if y[1]<b:
				z = marshal.loads(y[0])
				code = marshal.loads(z[0])
				func = types.FunctionType(code, globals(), "some_func_name") 
				o = objix.obj(objix.n, -1, '')
				o.load_persistent(objix.n, x)
				o.load_vals(objix.n, x)
				o.load_events(objix.n, x)
				o.add_event(func, time.time()+z[1], z[1])
				print o.remove_event(y[1])
				o.store_events(objix.m, objix.n)
				o.commit(objix.m)
				print func(o.import_namespace(objix.n))


while 1:	
	print clandestine()
	print time.time()
	time.sleep(30)